/*
 * JBoss, Home of Professional Open Source
 * Copyright 2010, Red Hat, Inc., and individual contributors
 * by the @authors tag. See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,  
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package javax.enterprise.context.spi;

/**
 * <p>
 *     提供继承{@link Contextual} 对象的实例在创建和销毁期间使用的操作
 * </p>
 *
 * @author Gavin King
 * @author Pete Muir
 *
 * @param <T> 这个CreationalContext操作的实例的类型
 */
public interface CreationalContext<T> {

    /**
     * 向容器注册一个不完全初始化的上下文实例.
     *
     * 一个上下文实例在它被{@link Contextual#create(CreationalContext)} 返回前，都被认为是不完全初始化。
     *
     * @param incompleteInstance 不完全初始化的实例
     */
    public void push(T incompleteInstance);

    /**
     * 通过通过将每个依赖对象传递给{@link Contextual#destroy(Object, CreationalContext)}，销毁正在销毁的实例的所有依赖对象
     */
    public void release();

}
